package bat.iog.hytool.excel;

import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * https://blog.csdn.net/weixin_42039228/article/details/123794466
 */
public class ExcelUtils {
    
    /**
     * 导出excel模板
     */
    public void exportExcelTemplate() {
        //exportExcel();
    }

    /**
     * 导出excel数据文件
     */
    public void exportExcelDataFile() {
        
    }

    /**
     * 导入excel数据文件
     */
    public void importExcelDataFile() {
        
    }

    /**
     * 获取excel行数
     * @param file
     * @return
     * @throws IOException
     */
    public static int getExcelRows(File file) throws IOException {
        HSSFWorkbook hssfWorkbook = new HSSFWorkbook(new FileInputStream(file));
        HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
        return hssfSheet.getLastRowNum();
    }
}
